const install = (app) => {
	let getBanner = (params = {}, config = {}) => uni.$u.get('/guide/banner/mini', params,config);	
	// 根据类型获取协议详细信息
	let getContentInfo = (type,params = {}, config = {}) => uni.$u.get(`/content/${type}/info`, params,config);	
	
	let getProduct = (params = {}, config = {}) => uni.$u.get('/product', params,config);
	let getProductDetail = (sid) => uni.$u.get(`/product/${sid}`);
	let getProductClassification = (params = {}, config = {}) => uni.$u.get('/classification', params,config);
	// 获取商品全部评价
	let getProductEvaluate = (params = {}, config = {}) => uni.$u.get('/product/page-evaluate', params,config);
	
	
	
	
	let addCart = (sid,count) => uni.$u.post(`/product/add-cart/${sid}/${count}`);
	let getCart = (params = {}, config = {}) => uni.$u.get('/cart', params,config);
	let deleteCart = (params = {}, config = {}) => uni.$u.put('/cart/delete', params,config);
	let updataCart = (params = {}, config = {}) => uni.$u.put('/cart/add-sub', params,config);
	
	
	let addAddress = (params,config) => uni.$u.post(`/address`, params,config);
	let getAddress = (params = {}, config = {}) => uni.$u.get('/address', params,config);
	let getDefaultAddress = (params = {}, config = {}) => uni.$u.get('/address/default', params,config);
	let deleteAddress = (params = {}, config = {}) => uni.$u.put('/address/delete', params,config);
	let editAddress = (sid,params = {}, config = {}) => uni.$u.put(`/address/${sid}`, params,config);
	let getAddressDetail = (sid,params = {}, config = {}) => uni.$u.get(`/address/${sid}`, params,config);
	
	let addOrder = (params,config) => uni.$u.post(`/order`, params,config);
	let getOrder = (params = {}, config = {}) => uni.$u.get('/order', params,config);
	let getShareOrder = (params = {}, config = {}) => uni.$u.get('/order/share', params,config);
	let getOrderDetail = (sid,params = {}, config = {}) => uni.$u.get(`/order/${sid}`, params,config);
	let editOrder = (sid,params = {}, config = {}) => uni.$u.put(`/order/${sid}`, params,config);
	let updateStatusOrder = (params = {}, config = {}) => uni.$u.put(`/order/update-status`, params,config);
	// 挂单区商品下单
	let pendingOrder = (sid,params = {}, config = {}) => uni.$u.put(`/order/pending/${sid}`, params,config);
	// 评价订单中的商品
	let editEvaluateOrder = (params,config) => uni.$u.post(`/order/evaluate`, params,config);
	// 获取我的订单评价
	let getOrderEvaluate = (sid,params = {}, config = {}) => uni.$u.get(`/product/my-evaluate/${sid}`, params,config);
	
	// 获取我的团队信息 0=未完成 1=已完成
	let getItem = (type,params = {}, config = {}) => uni.$u.get(`/item/${type}`, params,config);
	// 获取用户的直推下级
	let getLowerUser = (params = {}, config = {}) => uni.$u.get(`/item/lower-user`, params,config);
	
	// H5分页获取我的积分信息
	let getPointsMe = (params = {}, config = {}) => uni.$u.get('/points/me', params,config);
	// 积分变更
	let changePoints = (params = {}, config = {}) => uni.$u.post('/points', params, config);
	// H5分页获取我的佣金信息
	let getCommissionMe = (params = {}, config = {}) => uni.$u.get('/commission/me', params,config);
	// H5分页获取我的提现信息
	let getWithdrawalMe = (params = {}, config = {}) => uni.$u.get('/withdrawal/me', params,config);
	// 申请提现
	let withdrawal = (params = {}, config = {}) => uni.$u.post(`/withdrawal`, params,config);	
	// 获取营销-提现配置(1=营销配置 2=提现配置)
	let getCommissionConfigs = (type,params = {}, config = {}) => uni.$u.get(`/configs/commission/${type}`, params,config);
	
	let publicKey = (params = {}, config = {}) => uni.$u.get('/authentication/public-key', params,config);
	let loginMobile = (params = {}, config = {}) => uni.$u.post('/authentication/login/mobile', params, config);
	let registerMobile = (params = {}, config = {}) => uni.$u.post('/authentication/register/mobile', params, config);
	let logout = (params = {}, config = {}) => uni.$u.delete('/authentication/logout', params, config);
	// 获取用户自己的信息
	let getUsersMe = (params = {}, config = {}) => uni.$u.get('/users/me', params,config);
	// 用户修改自己的信息
	let editUsersMe = (params = {}, config = {}) => uni.$u.put('/users/me', params,config);
	// 生成我的推荐码
	let getUsersCode = (params = {}, config = {}) => uni.$u.get('/users/generate-code', params,config);
	// 发送验证码
	let sendCode = (params = {}, config = {}) => uni.$u.post(`/users/send-code`, params,config);
	// 用户修改密码
	let updatePassword = (params = {}, config = {}) => uni.$u.put('/users/update-password', params,config);
	// 验证码登录
	let loginCode = (params = {}, config = {}) => uni.$u.post(`/authentication/login/code`, params,config);
	
	// 分页获取自提地址信息
	let getPickupAddress = (params = {}, config = {}) => uni.$u.get('/pickup/address', params,config);
	
	// 分页获取字典成员信息	
	let getDictMembers = (params = {}, config = {}) => uni.$u.get('/dict-members', params,config);
	
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	uni.$u.api = {
		getBanner,
		getContentInfo,
		getProduct,
		getProductDetail,
		getProductClassification,
		getProductEvaluate,
		addCart,
		getCart,
		deleteCart,
		updataCart,
		getCommissionConfigs,
		publicKey,
		loginMobile,
		registerMobile,
		logout,
		getUsersMe,
		addAddress,
		getAddress,
		getDefaultAddress,
		deleteAddress,
		editAddress,
		getAddressDetail,
		addOrder,
		getOrder,
		getShareOrder,
		getOrderDetail,
		editOrder,
		updateStatusOrder,
		pendingOrder,
		editEvaluateOrder,
		getOrderEvaluate,
		getItem,
		getPointsMe,
		changePoints,
		getPickupAddress,
		getDictMembers,
		getCommissionMe,
		getWithdrawalMe,
		withdrawal,
		editUsersMe,
		getUsersCode,
		sendCode,
		loginCode,
		updatePassword,
		getLowerUser
	};
}

export default {
	install
}